

#ifndef __I_ASSET_ASSETREADER_H__
#define __I_ASSET_ASSETREADER_H__

#include <export.h>
#include <engine.h>
#include <iobject.h>
#include <asset/asset.h>


/**
 * @brief Interface for reading assets.
 *
 * An asset reader can practicaly read everything that derives from the
 * ceAsset class.
 *
 * To use such an asset reader just check if the reader is capable of
 * reading the specified asset. One can check that by using the CanRead()
 * method. When the reader stated, that it \a can read the asset one can
 * actually read it by using the Read() method.
 *
 * @code
 * iAssetReader* reader = ...; // get it from somewhere
 * ceAssetTypeID id = ...; // get it from somewhere
 * ceAssetLocator locator = ...; // get it from somewhere
 * ceAsset* asset = 0;
 * if (reader->CanRead (id, locator))
 * {
 *   asset = reader->Read (id, locator);
 * }
 *
 * // do the actions with the asset...
 * @endcode
 *
 * Implementiation of this interface MUST not increment the ref counter.
 */
struct iAssetReader : public iObject
{

	/**
	 * @brief Make a test if the reader is capable of reading the specified
	 *				element
	 *
	 * @param engine	The base system for acces into the engine.
	 * @param type		The asset type identifier.
	 * @param locator	The location where the asset can be found.
	 *
	 * @return \a True if the iAssetReader is capable of reading the asset.
	 */
	virtual bool CanRead (ceEngine* engine, ceAssetTypeID type, const ceAssetLocator& locator) = 0;

	/**
	 * @brief Read in the asset specified by the given type at the location specified by \a locator.
	 *
	 * @param engine	The base system for acces into the engine.
	 * @param type		The asset type identifier.
	 * @param locator	The location where the asset can be found.
	 *
	 *
	 * @return A new instance of the specified asset.
	 */
  virtual ceRef<ceAsset> Read (ceEngine* engine, ceAssetTypeID type, const ceAssetLocator& locator) = 0;

};

#endif /* ! __I_ASSET_ASSETREADER_H__ */

